#include <Lucnx/printk.h>
#include <Lucnx/interrupt.h>
#include <Lucnx/vsprintf.h>
#include <Lucnx/console.h>
#include <Lucnx/stdlib.h>

static char buf[1024];

// 打印错误信息
void _panic(int line, char *file_name, char *contition, ...)
{
    va_list ap;
    va_start(ap, contition);
    vsprintf(buf, contition, ap);

    printk("[PANIC %s %d] %s\n", file_name, line, buf);

    va_end(ap);
    hang();
}

void _infok(char *type, char *fmt, ...)
{
    va_list ap;
    va_start(ap, fmt);

    vsprintf(buf, fmt, ap);

    printk("[\e%s\e] %s\n", type, buf);

    va_end(ap);
}

void _outk(char *exporter, char *fmt, ...)
{
    va_list ap;
    va_start(ap, fmt);

    vsprintf(buf, fmt, ap);

    printk("%s: %s\n", exporter, buf);

    va_end(ap);
}